package com.qyzmt.controller;

import com.qyzmt.service.AIassistantService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/api/ai")
@RestController
public class AIassistantController {

    @Autowired
    private AIassistantService aIassistantService;

    // 用户向AI提问
    @PostMapping("/chat")
    public String aiQuestion(@RequestBody String question){
        log.info("用户向AI提问:{}",question);
        String AIAnswer = aIassistantService.aiQuestion(question);
        log.info("AI回答:{}",AIAnswer);
        return AIAnswer;


    }

}
